How to use the Netsh Command to manage Windows Firewall |
您所在的位置:网站首页 › netsh firewall set opmode mode=disable › How to use the Netsh Command to manage Windows Firewall |
Netsh or Network Shell is a command-line utility that helps IT admins configure and view various network-related functions on Windows 10. This utility can be used to manage Windows Firewall as well, and if you are looking for some straightforward ways that on the command line, then it is a useful utility to know and use. Use Netsh Command to manage Windows FirewallWindows Firewall configuration is available deep into the settings, which makes it uncountable. There are no context menus and a one-step method to get a few things done. It is beneficial when you need to do that often. You can save the command in a BAT file and run it with admin permission to execute it quickly. There used to be netsh firewall command, but that has been replaced or will be deprecated by netsh advfirewall. The list of options you get the advfirewall are as follows: consec – Changes to the `netsh advfirewall consec’ context.dump – Displays a configuration script.export – Exports the current policy to a file.firewall – Changes to the `netsh advfirewall firewall’ context.add – Adds a new inbound or outbound firewall rule.delete – Deletes all matching firewall rules.dump – Displays a configuration script.set – Sets new values for properties of an existing rule.show – Displays a specified firewall rule.help – Displays a list of commands.import – Imports a policy file into the current policy store.mainmode – Changes to the `netsh advfirewall mainmode’ context.monitor – Changes to the `netsh advfirewall monitor’ context.reset – Resets the policy to the default out-of-box policy.set – Sets the per-profile or global settings.show – Displays profile or global properties.List of Firewall Commands (Examples)Here is the list of some common commands you can use, such as to enable ports, allow programs, and so on. Enable a Port netsh advfirewall firewall add rule name= "Open Port 80" dir=in action=allow protocol=TCP localport=80 Delete enabled programs or ports netsh advfirewall firewall delete rule name= rule name program="C:\MyApp\MyApp.exe" netsh advfirewall firewall delete rule name= rule name protocol=udp localport=500 Enable specific services netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes netsh advfirewall firewall set rule group="remote desktop" new enable=Yes Enable Windows firewall netsh advfirewall set currentprofile state on Restore policy defaults netsh advfirewall reset There are many more things that you can do with Netsh utility. Covering all of them will be out of scope, and hence we recommend reading more details on the official Microsoft Documents. Read next: How to allow Pings (ICMP Echo requests) through Windows Firewall. More |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |